{extend name="User:base" /}
{block name="title"}
个人中心
{/block}
{block name="resources"}
	{load href="__PUBLIC__/static/css/index/common.css" /}
	{load href="__PUBLIC__/static/css/index/user_nav.css" /}
	{load href="__PUBLIC__/static/css/index/user_common.css" /}
	{load href='__PUBLIC__/static/jquery-ui-1.12.1/jquery-ui.css' /}
	{load href='__PUBLIC__/static/jquery-ui-1.12.1/jquery-ui.js' /}
    {load href="__PUBLIC__/static/js/address.js" /}
{/block}
{block name="detail"}
    <div class="user-tab">
    	<button onclick="showAddAddressDialog()">新增收货地址</button>
    </div>
    <div class="user-content">
    	<div id="item-address" default-url="{:url('index/address/setDefault')}" delete-url="{:url('index/address/delete')}" get-url="{:url('index/address/getArea')}" get-all-url="{:url('index/address/getAllArea')}">
    		<h3></h3>
            {volist name="list" id="list"}
            <div class="address-box clearfix" address-id="{$list.id}">
                <div class="address-info fl">
                    <div class="item"><span>收货人：</span><div class="ib">{$list.consignee}</div></div>
                    <div class="item"><span>所在地区：</span><div class="ib address-area">
                            <span area-id="{$list.provinceId}">{$list.province}</span
                            ><span area-id="{$list.cityId}">{$list.city}</span
                            ><span area-id="{$list.countyId}">{$list.county}</span>
                        </div>
                    </div>
                    <div class="item"><span>地址：</span><div class="ib address-detail">{$list.address}</div></div>
                    <div class="item"><span>手机：</span><div class="ib">{$list.mobile}</div></div>
                </div>
                <div class="extra-r">
                    <a href="javascript:;" onclick="setAddressDefault({$list.id})">设为默认地址</a><br/>
                    <a href="javascript:;" onclick="showEditAddressDialog({$list.id},this)"">修改</a><br/>    
                    <a href="javascript:;" onclick="deleteAddress({$list.id})">删除</a>
                </div>
            </div>
            {/volist}
    	</div>
    </div>

    <div id="add-address-dialog" style="display: none;">
        <form id="new-address-form" action="{:url('index/address/add')}" method="post">
            <div class="item">联系人</div><input type="text" name="consignee">
            <div class="item">联系电话</div><input type="text" name="mobile">
            <div class="item">地址</div>
            <div id="address-choic-add">
                <select name="province" class="province select" >
                    <option value="">请选择</option>
                </select>
                <select name="city" class="city select">
                    <option value="">请选择</option>
                </select>
                <select name="county" class="county select">
                    <option value="">请选择</option>
                </select>
            </div>
            <input type="text" name="address">
        </form>
    </div>

    <div id="edit-address-dialog" style="display: none;">
        <form id="edit-address-form" action="{:url('index/address/edit')}" method="post">
            <input type="hidden" name="id" value="">
            <div class="item">联系人</div><input type="text" name="consignee">
            <div class="item">联系电话</div><input type="text" name="mobile">
            <div class="item">地址</div>
            <div id="address-choic-edit">
                <select name="province" id="qqq" class="province select" >
                    <option value="">请选择</option>
                </select>
                <select name="city" class="city select">
                    <option value="">请选择</option>
                </select>
                <select name="county" class="county select">
                    <option value="">请选择</option>
                </select>
            </div>
            <input type="text" id="qqq" name="address">
        </form>
    </div>

{/block}


//去重 拼接字符串 where in -- id=》name 拼接数据